import { Type } from "class-transformer"
import { IsInt, IsNumber, IsString, Min } from "class-validator"
import { CommonClass } from "../public/classes/common"

export class Conditions extends CommonClass {
  @Min(1, { message: 'pageNumber必须大于等于1' })
  @IsInt({ message: 'pageNum必须是整数' })
  @Type(() => Number)
  page: number = 1

  @Min(5, { message: 'pageNumber必须大于等于5' })
  @IsInt({ message: 'pageNum必须是整数' })
  @Type(() => Number)
  limit: number = 10

  @IsString({ message: 'keyWord必须时字符串' })
  @Type(() => String)
  keyWord: string = ''
}